home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / s / alterboxesonpages.pprx < prev    next >
Text File  |  1992-03-14  |  6KB  |  277 lines

  1. /*
  2. @BAlterBoxesOnPages  @P@ICopyright Gold Disk Inc. February, 1992.
  3.  
  4. This Genie will alter each box at a particular position on a range of pages. You will be prompted to select the box which occurs at a position on the range of pages.
  5. Next you will be prompted to select an attribute to be changed. The change will take place on all boxes in the range which are in the same position as the one clicked on.
  6. */
  7. cr = '0a'x
  8. pageopts = "OODDEEVENAALL"
  9. address command
  10. call SafeEndEdit.rexx()
  11. call ppm_AutoUpdate(0)
  12. counter = 0
  13.  
  14. signal on error
  15. signal on syntax
  16.  
  17.  
  18. commands.1      = "Position"
  19. commands.1.1    = "left:"cr"top:"
  20. commands.1.2    = "verifynumbers"
  21. commands.2      = "Angle"
  22. commands.2.1    = "Angle:"
  23. commands.2.2    = "verifynumbers"
  24. commands.3      = "Margins"
  25. commands.3.1    = "left:"cr"top:"cr"right:"cr"bottom:"
  26. commands.3.2    = "verifynumbers"
  27. commands.4      = "Standoff"
  28. commands.4.1    = "Standoff:"
  29. commands.4.2    = "verifynumbers"
  30. commands.5      = "Size"
  31. commands.5.1    = "width:"cr"height:"
  32. commands.5.2    = "verifynumbers"
  33. commands.6      = "Offset"
  34. commands.6.1    = "X offset:"cr"Y offset:"
  35. commands.6.2    = "verifynumbers"
  36. commands.7      = "Lock"
  37. commands.7.1    = "Enter Yes or No"
  38. commands.7.2    = "yntonumbers"
  39. commands.8      = "TextWrap"
  40. commands.8.1    = "Enter Type:"cr"Side:"
  41. commands.8.2    = "verifynumbers"
  42. commands.9      = "Hide"
  43. commands.9.1    = "Enter Yes or No"
  44. commands.9.2    = "yntonumbers"
  45. commands.10     = "Frame"
  46. commands.10.1   = "Enter Yes or No"
  47. commands.10.2   = "yntonumbers"
  48. commands.11     = "Transparent"
  49. commands.11.1   = "Enter Yes or No"
  50. commands.11.2   = "yntonumbers"
  51. commands.12     = "FrameData"
  52. commands.12.1   = "Line Color:"cr"Fill Color:"cr"Line Weight:"cr"Line Pattern:"cr"Fill Pattern:"
  53. commands.12.2   = ""
  54. commands.13     = "Tabs"
  55. commands.13.1   = "Tabs:"
  56. commands.13.2   = "verifytabs"
  57. commands.13.2    = "verifynumbers"
  58.  
  59. command = ''
  60.  
  61. do i = 1 to 13
  62.  
  63.     command = command||commands.i||cr
  64.  
  65. end
  66.  
  67. command = left(command, length(command) - 1)
  68.  
  69. boxpos    = ppm_GetClickPosition("Click on box to be altered on each page")
  70. boxtop    = word(boxpos, 2)
  71. boxleft = word(boxpos, 1)
  72. box    = ppm_BoxAtPosn(boxleft, boxtop)
  73. if box    = 0 then exit_msg()
  74.  
  75. command = ppm_SelectFromList("Select attribute to change..",30,5,0,command)
  76. if command = '' then exit_msg()
  77.  
  78. do i = 1 to 13
  79.  
  80.     if command = commands.i then leave
  81.  
  82. end
  83.  
  84. if pos(':', commands.i.1) ~= 0 then
  85. do
  86.    interpret "settings = ppm_GetBox"command"(box)"
  87.    commands.i.1 = stuffsettings(settings, commands.i.1)
  88. end
  89.  
  90. args = ppm_GetForm("Enter Values for "command, min(length(commands.i.1), 40), commands.i.1)
  91. if args = '' then exit_msg()
  92.  
  93. if command = "Tabs" then 
  94.    args = verifytabs(args)
  95. else
  96.    args = separate(args, commands.i.2)
  97.  
  98. docstart = ppm_DocFirstPage()
  99. docend = ppm_DocLastPage()
  100. pages = upper(ppm_GetForm("Enter range of pages", 20, "From:"docstart'0a'x "To:"docend'0a'x "ODD/EVEN/ALL"))
  101. if pages = '' then exit_msg()
  102.  
  103. parse var pages startpage '0a'x endpage '0a'x pageopt
  104.  
  105. if (startpage ~= '' & datatype(startpage) ~= NUM) | (endpage ~= '' & datatype(endpage) ~= NUM ) then exit_msg("Invalid Input")
  106.  
  107. increment = 1
  108.  
  109. /*
  110.  *  Check error conditions
  111.  */
  112. if startpage < docstart then exit_msg('Invalid Range')
  113. else if startpage > docend then exit_msg('Invalid Range')
  114. if endpage < docstart then exit_msg('Invalid Range')
  115. else if endpage > docend then exit_msg('Invalid Range')
  116. if endpage < startpage then exit_msg('Invalid Range')
  117.  
  118. if pageopt = 'ALL' | pageopt = 'A' then
  119. do
  120.     increment = 1
  121. end
  122. else if pageopt = 'EVEN' | pageopt = 'E' then
  123. do
  124.     increment    = 2
  125.     if (startpage // 2) then startpage = startpage + 1
  126. end
  127. else if pageopt = 'ODD' | pageopt = 'O' then
  128. do
  129.     increment    = 2
  130.     if ~(startpage // 2) then startpage = startpage + 1
  131. end
  132.  
  133. if startpage > endpage then
  134. do
  135.     temp    = startpage
  136.     startpage    = endpage
  137.     endpage    = temp
  138. end
  139. page = ppm_GotoPage(startpage)
  140. call ppm_AutoUpdate(0)
  141. do while page <= endpage
  142.  
  143.     call  ppm_GotoPage(page)
  144.     box = ppm_BoxAtPosn(boxleft, boxtop, page)
  145.     if box ~= 0 then    interpret "call ppm_SetBox"command||"(box, "args")"
  146.     page = page + increment
  147.  
  148. end
  149. page = ppm_GotoPage(startpage)
  150. exit_msg("Done")
  151.  
  152. error:
  153. syntax:
  154. do
  155.     exit_msg("Genie failed due to error: "errortext(rc))
  156. end
  157.  
  158. exit_msg:
  159. do
  160.     parse arg message
  161.  
  162.     if message ~= '' then
  163.         call ppm_Inform(1, message,)
  164.  
  165.    call ppm_ClearStatus()
  166.     call ppm_AutoUpdate(1)
  167.     exit
  168. end
  169.  
  170. separate:
  171. do
  172.     parse arg string, vfunction
  173.  
  174.     output  = ''
  175.  
  176.     do forever
  177.  
  178.         parse var string item '0a'x string
  179.  
  180.       if vfunction ~= '' then
  181.            interpret "item = "vfunction"("item")"
  182.  
  183.         item = "'"item"'"
  184.  
  185.         if string = '' then 
  186.             return(output||item)
  187.         else
  188.             output = output||item","
  189.     end
  190. end
  191.  
  192. verifynumbers: procedure
  193. do
  194.     parse arg number
  195.  
  196.     if ~datatype(number, n) then exit_msg("Invalid input")
  197.     return(number)
  198.  
  199. end
  200.  
  201.  
  202. yntonumbers: procedure 
  203. do
  204.     parse arg type
  205.  
  206.     type = upper(type)
  207.  
  208.     if left(type, 1) = "Y" then return(1)
  209.     if left(type, 1) = "N" then return(0)
  210.     call exit_msg("Invalid Entry")
  211. end
  212.  
  213. verifytabs: procedure 
  214. do
  215.    parse arg tabs
  216.  
  217.    output = ''
  218.  
  219.    tabs = strip(tabs)
  220.  
  221.    do 16
  222.  
  223.       parse var tabs tab ' ' tabs
  224.  
  225.       if tab = '' then tab = 0
  226.       if ~datatype(tab, n) then exit_msg("Invalid Entry")
  227.  
  228.       output = output" "tab
  229.  
  230.       tabs = strip(tabs)
  231.  
  232.    end
  233.  
  234.    return('"'output'"')
  235. end
  236.  
  237.  
  238. stuffsettings: procedure
  239. do
  240.    parse arg settings, prompt
  241.  
  242.    output = ''
  243.    counter = 1
  244.    colon = pos(':', prompt)
  245.    cr = pos('0a'x, settings)
  246.  
  247.    if cr ~= 0 then
  248.    do
  249.        do while colon ~= 0
  250.              
  251.           parse var settings default '0a'x settings
  252.  
  253.           prompt = insert(default, prompt, colon)
  254.           colon = pos(':', prompt, colon + 1)
  255.  
  256.        end
  257.  
  258.        return(prompt)
  259.  
  260.   end
  261.  
  262.  
  263.  
  264.    do while colon ~= 0
  265.  
  266.       prompt = insert(word(settings, counter), prompt, colon)
  267.       counter = counter + 1
  268.  
  269.       colon = pos(':', prompt, colon + 1)
  270.    end
  271.  
  272.    prompt = prompt" " || subword(settings, counter)
  273.  
  274.    return(prompt)
  275.  
  276. end
  277.